/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.sigodonto.model.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;

/**
 *
 * @author Fidelis
 */
@Entity
public class Odontograma implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private Long id;
    private String anotacoes;
    private Date data_realizacao;
    private List<Dente> dentes;

    public Odontograma() {
        this.dentes = new ArrayList<Dente>();
    }
    
    @Id
    @SequenceGenerator(name = "odontograma_id", sequenceName = "odontograma_sequence", allocationSize = 1, initialValue = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "odontograma_id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAnotacoes() {
        return anotacoes;
    }

    public void setAnotacoes(String anotacoes) {
        this.anotacoes = anotacoes;
    }

    @Temporal(javax.persistence.TemporalType.DATE)
    public Date getData_realizacao() {
        return data_realizacao;
    }

    public void setData_realizacao(Date data_realizacao) {
        this.data_realizacao = data_realizacao;
    }

    @OneToMany(cascade= CascadeType.ALL)
    public List<Dente> getDentes() {
        return dentes;
    }

    public void setDentes(List<Dente> dentes) {
        this.dentes = dentes;
    }
    
    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Odontograma)) {
            return false;
        }
        Odontograma other = (Odontograma) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.sigodonto.model.entity.Odontograma[ id=" + id + " ]";
    }
    
}
